/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Ultils;

import DAO.ContactDAO;
import DAO.ProductDAO;
import DAO.UserDAO;
import DAO.DistrictDAO;
import com.sun.codemodel.JCodeModel;
import com.sun.tools.xjc.api.S2JJAXBModel;
import com.sun.tools.xjc.api.SchemaCompiler;
import com.sun.tools.xjc.api.XJC;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sun.tools.xjc.api.ErrorListener;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
import DTO.xmlobject.Products.Products;
import DTO.xmlobject.Contacts.Contacts;
import DTO.xmlobject.Districts.Districts;
import DTO.xmlobject.Users.Users;

/**
 *
 * @author ASUS
 */
public class JAXBGeneration {

    public static void main(String[] args) {
//        try {
//            String output = "src/java";
//            SchemaCompiler sc = XJC.createSchemaCompiler();
//            sc.setErrorListener(new ErrorListener() {
//
//                public void error(SAXParseException saxpe) {
//                    throw new UnsupportedOperationException("Not supported yet.");
//                }
//
//                public void fatalError(SAXParseException saxpe) {
//                    throw new UnsupportedOperationException("Not supported yet.");
//                }
//
//                public void warning(SAXParseException saxpe) {
//                    throw new UnsupportedOperationException("Not supported yet.");
//                }
//
//                public void info(SAXParseException saxpe) {
//                    throw new UnsupportedOperationException("Not supported yet.");
//                }
//            });
//
//            sc.forcePackageName("DTO.xmlobject.Contact");
//            File schema = new File("src/java/xsd/Contacts.xsd");
//            InputSource is = new InputSource(schema.toURI().toString());
//            sc.parseSchema(is);
//            S2JJAXBModel model = sc.bind();
//            JCodeModel code = model.generateCode(null, null);
//            code.build(new File(output));
//            System.out.println("Finishes");            
//        } catch (IOException ex) {
//            ex.printStackTrace();
//            Logger.getLogger(JAXBGeneration.class.getName()).log(Level.SEVERE, null, ex);
//        }
        getProductTest();
    }
    
    /**
     *
     */

    /**
     *
     */
    public static void getProductTest(){
        UserDAO ContactService = new UserDAO();
        Users contacts =  ContactService.getAllUser();
        System.out.println(contacts);
    }
}
